package leetcode;

import org.junit.Test;

import java.util.Arrays;

/**
 * @author Mr.LL
 * @version 1.0
 */
public class leetcode27 {

    @Test
    public void test(){
        int[] nums = {3,2,2,3};
        int val = 3;
        System.out.println(removeElement(nums,val));
    }

    public int removeElement(int[] nums,int val){
        int index=0;
        for (int i=0;i<nums.length;i++){
            if (nums[i] != val){
                nums[index++] = nums[i];
            }
        }
        return index;
    }
}
